package android.slc.box.core.scope;

import android.slc.box.core.launcher.StageLauncherConfig;
import javafx.stage.Stage;

/**
 * @author slc
 * @date 2022/09/21 上午 10:56
 */
public class StageScope extends ProtectedScopeImpl {
    private final Stage ownerStage;
    private final Stage currentStage;
    private final StageLauncherConfig stageLauncherConfig;

    public static StageScope newInstance(Stage ownerStage, Stage currentStage, StageLauncherConfig stageLauncherConfig) {
        return new StageScope(ownerStage, currentStage, stageLauncherConfig);
    }

    private StageScope(Stage ownerStage, Stage currentStage, StageLauncherConfig stageLauncherConfig) {
        this.ownerStage = ownerStage;
        this.currentStage = currentStage;
        this.stageLauncherConfig = stageLauncherConfig;
        initScope();
    }

    private void initScope() {
        this.stageLauncherConfig.giveStage(this.ownerStage, this.currentStage);
    }

    public Stage getOwnerStage() {
        return ownerStage;
    }

    public Stage getCurrentStage() {
        return currentStage;
    }

    public StageLauncherConfig getStageLauncherConfig() {
        return stageLauncherConfig;
    }

}
